package com.kzj.mls.recyclerCard.cardView;

import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.widget.EditText;

import com.kzj.mls.R;
import com.kzj.mls.recyclerCard.basic.CardItemView;
import com.kzj.mls.recyclerCard.card.other.SuggestCard;

/**
 * Created by xyg on 2015/10/26.
 */
public class SuggestCardView extends CardItemView<SuggestCard> {

    private Context context;
    private EditText editText_suggest;

    public SuggestCardView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public SuggestCardView(Context context) {
        super(context);
        this.context = context;
    }

    public SuggestCardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
    }

    @Override
    public void build(final SuggestCard card) {
        super.build(card);
        editText_suggest = (EditText) findViewById(R.id.editText_suggest);
        editText_suggest.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                card.setSuggest(s.toString());
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
    }
}
